# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 18
n 18(None)[self._initialized = True
self._last_timestamp = 0
sel_task = Task(self._fix_selected)
sel_task.delay = self.duration * 2
sel_task._considered_idle = True
self._schedule_selected = sel_task.start
start = self.menu_list.selected_pos - self._selected
GenericListing._create_content(self, start, self.style_name[:-6])
]:
	i: 9(), 17()
	o: 

nname: 17
n 17(None)[]:
	i: 0(f)
	o: 18()

nname: 9
n 9(None)[]:
	i: 0(t)
	o: 18()

nname: 0
n 0(self._initialized)[]:
	i: 
	o: 9(t), 17(f)

nname: 0
n 0(None)[if self._initialized:
	pass
self._initialized = True
self._last_timestamp = 0
sel_task = Task(self._fix_selected)
sel_task.delay = self.duration * 2
sel_task._considered_idle = True
self._schedule_selected = sel_task.start
start = self.menu_list.selected_pos - self._selected
GenericListing._create_content(self, start, self.style_name[:-6])
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76e7bac>}
nname: 678
n 678(None)[return None
]:
	i: 651(), 677()
	o: 

nname: 677
n 677(None)[]:
	i: 642(f)
	o: 678()

nname: 651
n 651(None)[self._edited = False
self.do_edit(True)
]:
	i: 642(t)
	o: 678()

nname: 642
n 642(self._edited)[]:
	i: 607(JA), 624(), 641()
	o: 651(t), 677(f)

nname: 641
n 641(None)[]:
	i: 559(f)
	o: 642()

nname: 624
n 624(None)[self._bar.hide()
]:
	i: 584&591(f)
	o: 642()

nname: 607
n 607(None)[self._bar.show()
]:
	i: 584&591(t)
	o: 642(JA)

nname: 584&591
n 584&591(len_ml and il.selected >= 0)[]:
	i: 559(t)
	o: 607(t), 624(f)

nname: 559
n 559(self._bar is not None)[self._refresh_more_items()
]:
	i: 323(JA), 337(), 516()
	o: 584&591(t), 641(f)

nname: 516
n 516(None)[il.selected = ml.selected_pos
il.start = start
il.end = end
self._hidden_item.destroy()
]:
	i: 373(AL), 515()
	o: 559()

nname: 515
n 515(None)[]:
	i: 377(AF), 475()
	o: 516()

nname: 475
n 475(None)[ui_item.reset(menu_item, menu_item is selected, position=start + i + 1)
]:
	i: 405(f), 461()
	o: 515()

nname: 461
n 461(None)[ui_item.destroy()
continue
]:
	i: 405(t)
	o: 475()

nname: 405
n 405(menu_item is None)[for i, pos in enumerate(map(None, pl, il, menu_list)):
ui_item.widget.animate_stop()
pos.put(ui_item)
]:
	i: 377(for)
	o: 461(t), 475(f)

nname: 377
n 377(None)[]:
	i: 373(loop)
	o: 405(for), 515(AF)

nname: 373
n 373(None)[]:
	i: 258&270(f)
	o: 377(loop), 516(AL)

nname: 337
n 337(None)[ui_item.reset(menu_item, menu_item is selected, position=position + 1)
]:
	i: 283(f)
	o: 559()

nname: 323
n 323(None)[ui_item.destroy()
]:
	i: 283(t)
	o: 559(JA)

nname: 283
n 283(menu_item is None)[menu_item = ml[position]
ui_item = il[position - il.start]
]:
	i: 258&270(t)
	o: 323(t), 337(f)

nname: 258&270
n 258&270(position is not None and position >= 0)[]:
	i: 221(JA), 253(), 257()
	o: 283(t), 373(f)

nname: 257
n 257(None)[]:
	i: 0&156(f)
	o: 258&270()

nname: 253
n 253(None)[]:
	i: 209(f)
	o: 258&270()

nname: 221
n 221(None)[diff = end - len_ml
menu_list[-diff:] = ml[0:diff]
]:
	i: 209(t)
	o: 258&270(JA)

nname: 209
n 209(end > len_ml)[]:
	i: 182(), 208()
	o: 221(t), 253(f)

nname: 208
n 208(None)[]:
	i: 169(f)
	o: 209()

nname: 182
n 182(None)[menu_list[0:-start] = ml[len_ml + start:]
]:
	i: 169(t)
	o: 209()

nname: 169
n 169(start < 0)[]:
	i: 0&156(t)
	o: 182(t), 208(f)

nname: 0&156
n 0&156(self._cyclic and len_ml > 2)[ml = self.menu_list
il = self.item_list
pl = self.positions_list
start = ml.selected_pos - self._selected
end = start + len(pl)
len_ml = len(ml)
selected = ml.selected
menu_list = [None] * max(0, -start) + ml[max(0, start):end] + [None] * max(0, end - len_ml)
]:
	i: 
	o: 169(t), 257(f)

nname: 678
n 678(None)[return None
]:
	i: 559()
	o: 

nname: 559
n 559(None)[self._refresh_more_items()
if self._bar is not None:
	if len_ml and il.selected >= 0:
		self._bar.show()
	else:
		self._bar.hide()
if self._edited:
	self._edited = False
	self.do_edit(True)
]:
	i: 283(JA), 516()
	o: 678()

nname: 516
n 516(None)[il.selected = ml.selected_pos
il.start = start
il.end = end
self._hidden_item.destroy()
]:
	i: 373(AL), 377(AF), 405()
	o: 559()

nname: 405
n 405(None)[for i, pos in enumerate(map(None, pl, il, menu_list)):
ui_item.widget.animate_stop()
pos.put(ui_item)
if menu_item is None:
	ui_item.destroy()
	continue
ui_item.reset(menu_item, menu_item is selected, position=start + i + 1)
]:
	i: 377(for)
	o: 516()

nname: 377
n 377(None)[]:
	i: 373(loop)
	o: 405(for), 516(AF)

nname: 373
n 373(None)[]:
	i: 258&270(f)
	o: 377(loop), 516(AL)

nname: 283
n 283(None)[menu_item = ml[position]
ui_item = il[position - il.start]
if menu_item is None:
	ui_item.destroy()
else:
	ui_item.reset(menu_item, menu_item is selected, position=position + 1)
]:
	i: 258&270(t)
	o: 559(JA)

nname: 258&270
n 258&270(position is not None and position >= 0)[]:
	i: 169(JA), 0&156(f)
	o: 283(t), 373(f)

nname: 169
n 169(None)[if start < 0:
	menu_list[0:-start] = ml[len_ml + start:]
if end > len_ml:
	diff = end - len_ml
	menu_list[-diff:] = ml[0:diff]
]:
	i: 0&156(t)
	o: 258&270(JA)

nname: 0&156
n 0&156(self._cyclic and len_ml > 2)[ml = self.menu_list
il = self.item_list
pl = self.positions_list
start = ml.selected_pos - self._selected
end = start + len(pl)
len_ml = len(ml)
selected = ml.selected
menu_list = [None] * max(0, -start) + ml[max(0, start):end] + [None] * max(0, end - len_ml)
]:
	i: 
	o: 169(t), 258&270(f)

nname: 559
n 559(None)[self._refresh_more_items()
if self._bar is not None:
	if len_ml and il.selected >= 0:
		self._bar.show()
	else:
		self._bar.hide()
if self._edited:
	self._edited = False
	self.do_edit(True)
return None
]:
	i: 283(JA), 405()
	o: 

nname: 405
n 405(None)[for i, pos in enumerate(map(None, pl, il, menu_list)):
	ui_item.widget.animate_stop()
	pos.put(ui_item)
	if menu_item is None:
		ui_item.destroy()
		continue
	ui_item.reset(menu_item, menu_item is selected, position=start + i + 1)
il.selected = ml.selected_pos
il.start = start
il.end = end
self._hidden_item.destroy()
]:
	i: 373(for)
	o: 559()

nname: 373
n 373(None)[]:
	i: 0&156(f)
	o: 405(for)

nname: 283
n 283(None)[menu_item = ml[position]
ui_item = il[position - il.start]
if menu_item is None:
	ui_item.destroy()
else:
	ui_item.reset(menu_item, menu_item is selected, position=position + 1)
]:
	i: 0&156(t)
	o: 559(JA)

nname: 0&156
n 0&156(position is not None and position >= 0)[ml = self.menu_list
il = self.item_list
pl = self.positions_list
start = ml.selected_pos - self._selected
end = start + len(pl)
len_ml = len(ml)
selected = ml.selected
menu_list = [None] * max(0, -start) + ml[max(0, start):end] + [None] * max(0, end - len_ml)
if self._cyclic and len_ml > 2:
	if start < 0:
		menu_list[0:-start] = ml[len_ml + start:]
	if end > len_ml:
		diff = end - len_ml
		menu_list[-diff:] = ml[0:diff]
]:
	i: 
	o: 283(t), 373(f)

nname: 559
n 559(None)[self._refresh_more_items()
if self._bar is not None:
	if len_ml and il.selected >= 0:
		self._bar.show()
	else:
		self._bar.hide()
if self._edited:
	self._edited = False
	self.do_edit(True)
return None
]:
	i: 283(JA), 373()
	o: 

nname: 373
n 373(None)[for i, pos in enumerate(map(None, pl, il, menu_list)):
	ui_item.widget.animate_stop()
	pos.put(ui_item)
	if menu_item is None:
		ui_item.destroy()
		continue
	ui_item.reset(menu_item, menu_item is selected, position=start + i + 1)
il.selected = ml.selected_pos
il.start = start
il.end = end
self._hidden_item.destroy()
]:
	i: 0&156(f)
	o: 559()

nname: 283
n 283(None)[menu_item = ml[position]
ui_item = il[position - il.start]
if menu_item is None:
	ui_item.destroy()
else:
	ui_item.reset(menu_item, menu_item is selected, position=position + 1)
]:
	i: 0&156(t)
	o: 559(JA)

nname: 0&156
n 0&156(position is not None and position >= 0)[ml = self.menu_list
il = self.item_list
pl = self.positions_list
start = ml.selected_pos - self._selected
end = start + len(pl)
len_ml = len(ml)
selected = ml.selected
menu_list = [None] * max(0, -start) + ml[max(0, start):end] + [None] * max(0, end - len_ml)
if self._cyclic and len_ml > 2:
	if start < 0:
		menu_list[0:-start] = ml[len_ml + start:]
	if end > len_ml:
		diff = end - len_ml
		menu_list[-diff:] = ml[0:diff]
]:
	i: 
	o: 283(t), 373(f)

nname: 0&156
n 0&156(None)[ml = self.menu_list
il = self.item_list
pl = self.positions_list
start = ml.selected_pos - self._selected
end = start + len(pl)
len_ml = len(ml)
selected = ml.selected
menu_list = [None] * max(0, -start) + ml[max(0, start):end] + [None] * max(0, end - len_ml)
if self._cyclic and len_ml > 2:
	if start < 0:
		menu_list[0:-start] = ml[len_ml + start:]
	if end > len_ml:
		diff = end - len_ml
		menu_list[-diff:] = ml[0:diff]
if position is not None and position >= 0:
	menu_item = ml[position]
	ui_item = il[position - il.start]
	if menu_item is None:
		ui_item.destroy()
	else:
		ui_item.reset(menu_item, menu_item is selected, position=position + 1)
else:
	for i, pos in enumerate(map(None, pl, il, menu_list)):
		ui_item.widget.animate_stop()
		pos.put(ui_item)
		if menu_item is None:
			ui_item.destroy()
			continue
		ui_item.reset(menu_item, menu_item is selected, position=start + i + 1)
	il.selected = ml.selected_pos
	il.start = start
	il.end = end
	self._hidden_item.destroy()
self._refresh_more_items()
if self._bar is not None:
	if len_ml and il.selected >= 0:
		self._bar.show()
	else:
		self._bar.hide()
if self._edited:
	self._edited = False
	self.do_edit(True)
return None
]:
	i: 
	o: 

self.nodes: {'0&156': <unpyclib.structure.node instance at 0xb76eed6c>}
nname: 458
n 458(None)[return None
]:
	i: 423(JA), 440(), 457()
	o: 

nname: 457
n 457(None)[]:
	i: 308(f)
	o: 458()

nname: 440
n 440(None)[self._bar.hide()
]:
	i: 394&407(f)
	o: 458()

nname: 423
n 423(None)[self._bar.show()
]:
	i: 394&407(t)
	o: 458(JA)

nname: 394&407
n 394&407(len(ml) and il.selected >= 0)[]:
	i: 308(t)
	o: 423(t), 440(f)

nname: 308
n 308(self._bar is not None)[GenericListing._scroll(self, scroll_move, duration, None)
il.start += move
il.end += move
il.selected = position
self._refresh_more_items()
]:
	i: 297(JA), 303(), 307()
	o: 394&407(t), 457(f)

nname: 307
n 307(None)[]:
	i: 200(f)
	o: 308()

nname: 303
n 303(None)[]:
	i: 225&250(f)
	o: 308()

nname: 297
n 297(None)[scroll_move = 1
]:
	i: 286(), 293()
	o: 308(JA)

nname: 293
n 293(None)[]:
	i: 273(f)
	o: 297()

nname: 286
n 286(None)[]:
	i: 273(t)
	o: 297()

nname: 273
n 273(move > 0)[]:
	i: 225&250(t)
	o: 286(t), 293(f)

nname: 225&250
n 225&250(len_ml > 2 and abs(move) + 1 == len_ml)[len_ml = len(ml)
]:
	i: 200(t)
	o: 273(t), 303(f)

nname: 200
n 200(self._cyclic)[self._schedule_selected()
scroll_move = move
]:
	i: 179(), 199()
	o: 225&250(t), 307(f)

nname: 199
n 199(None)[]:
	i: 81(f)
	o: 200()

nname: 179
n 179(None)[il[self._selected].selected = False
]:
	i: 81(t)
	o: 200()

nname: 81
n 81(il[self._selected].selected)[previous_focus = il.start + self._selected
move = focus - previous_focus
ts = sched.ts
duration = max(0.001, min(self.duration, ts - self._last_timestamp - 0.12))
self._last_timestamp = ts
]:
	i: 71(), 80()
	o: 179(t), 199(f)

nname: 80
n 80(None)[]:
	i: 0(f)
	o: 81()

nname: 71
n 71(None)[focus = position
]:
	i: 62(), 70()
	o: 81()

nname: 70
n 70(None)[]:
	i: 30&46(f)
	o: 71()

nname: 62
n 62(None)[return True
]:
	i: 30&46(t)
	o: 71()

nname: 30&46
n 30&46(ml.selected is None or il.selected == position)[]:
	i: 0(t)
	o: 62(t), 70(f)

nname: 0
n 0(focus is None)[il = self.item_list
ml = self.menu_list
]:
	i: 
	o: 30&46(t), 80(f)

nname: 308
n 308(None)[GenericListing._scroll(self, scroll_move, duration, None)
il.start += move
il.end += move
il.selected = position
self._refresh_more_items()
if self._bar is not None:
	if len(ml) and il.selected >= 0:
		self._bar.show()
	else:
		self._bar.hide()
return None
]:
	i: 273(JA), 225&250(f), 81(f)
	o: 

nname: 273
n 273(None)[if move > 0:
	pass
scroll_move = 1
]:
	i: 225&250(t)
	o: 308(JA)

nname: 225&250
n 225&250(len_ml > 2 and abs(move) + 1 == len_ml)[len_ml = len(ml)
]:
	i: 81(t)
	o: 273(t), 308(f)

nname: 81
n 81(self._cyclic)[previous_focus = il.start + self._selected
move = focus - previous_focus
ts = sched.ts
duration = max(0.001, min(self.duration, ts - self._last_timestamp - 0.12))
self._last_timestamp = ts
if il[self._selected].selected:
	il[self._selected].selected = False
self._schedule_selected()
scroll_move = move
]:
	i: 30&46(), 0(f)
	o: 225&250(t), 308(f)

nname: 30&46
n 30&46(None)[if ml.selected is None or il.selected == position:
	return True
focus = position
]:
	i: 0(t)
	o: 81()

nname: 0
n 0(focus is None)[il = self.item_list
ml = self.menu_list
]:
	i: 
	o: 30&46(t), 81(f)

nname: 308
n 308(None)[GenericListing._scroll(self, scroll_move, duration, None)
il.start += move
il.end += move
il.selected = position
self._refresh_more_items()
if self._bar is not None:
	if len(ml) and il.selected >= 0:
		self._bar.show()
	else:
		self._bar.hide()
return None
]:
	i: 0(f)
	o: 

nname: 0
n 0(None)[il = self.item_list
ml = self.menu_list
if focus is None:
	if ml.selected is None or il.selected == position:
		return True
	focus = position
previous_focus = il.start + self._selected
move = focus - previous_focus
ts = sched.ts
duration = max(0.001, min(self.duration, ts - self._last_timestamp - 0.12))
self._last_timestamp = ts
if il[self._selected].selected:
	il[self._selected].selected = False
self._schedule_selected()
scroll_move = move
if self._cyclic:
	len_ml = len(ml)
	if len_ml > 2 and abs(move) + 1 == len_ml:
		if move > 0:
			pass
		scroll_move = 1
]:
	i: 
	o: 308(JA)

nname: 0
n 0(None)[il = self.item_list
ml = self.menu_list
if focus is None:
	if ml.selected is None or il.selected == position:
		return True
	focus = position
previous_focus = il.start + self._selected
move = focus - previous_focus
ts = sched.ts
duration = max(0.001, min(self.duration, ts - self._last_timestamp - 0.12))
self._last_timestamp = ts
if il[self._selected].selected:
	il[self._selected].selected = False
self._schedule_selected()
scroll_move = move
if self._cyclic:
	len_ml = len(ml)
	if len_ml > 2 and abs(move) + 1 == len_ml:
		if move > 0:
			pass
		scroll_move = 1
GenericListing._scroll(self, scroll_move, duration, None)
il.start += move
il.end += move
il.selected = position
self._refresh_more_items()
if self._bar is not None:
	if len(ml) and il.selected >= 0:
		self._bar.show()
	else:
		self._bar.hide()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76ee30c>}
nname: 42
n 42(None)[]:
	i: 18(), 41()
	o: 

nname: 41
n 41(None)[]:
	i: 0(f)
	o: 42()

nname: 18
n 18(None)[self.item_list[self._selected].selected = True
]:
	i: 0(t)
	o: 42()

nname: 0
n 0(self.item_list.selected != -1)[]:
	i: 
	o: 18(t), 41(f)

nname: 0
n 0(None)[if self.item_list.selected != -1:
	self.item_list[self._selected].selected = True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76ed60c>}
nname: 59
n 59(None)[scroll_up = ml.selected_pos == sel_index
GenericListing._remove_item(self, position, scroll_up)
il.selected = ml.selected_pos
il.start = ml.selected_pos - self._selected
il.end = il.start + len(il)
GenericListing._refresh_more_items(self)
il[self._selected].selected = True
]:
	i: 39(), 46()
	o: 

nname: 46
n 46(None)[]:
	i: 0(f)
	o: 59()

nname: 39
n 39(None)[]:
	i: 0(t)
	o: 59()

nname: 0
n 0(sel_index < position)[il = self.item_list
ml = self.menu_list
sel_index = il.selected
]:
	i: 
	o: 39(t), 46(f)

nname: 0
n 0(None)[il = self.item_list
ml = self.menu_list
sel_index = il.selected
if sel_index < position:
	pass
scroll_up = ml.selected_pos == sel_index
GenericListing._remove_item(self, position, scroll_up)
il.selected = ml.selected_pos
il.start = ml.selected_pos - self._selected
il.end = il.start + len(il)
GenericListing._refresh_more_items(self)
il[self._selected].selected = True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76edaac>}
nname: 158
n 158(None)[il.selected = ml.selected_pos
il.start = ml.selected_pos - self._selected
il.end = il.start + len(il)
]:
	i: 69(), 121(), 157()
	o: 

nname: 157
n 157(None)[]:
	i: 105(f)
	o: 158()

nname: 121
n 121(None)[GenericListing._scroll(self, i1 - i2, self.duration, ml.selected)
]:
	i: 105(t)
	o: 158()

nname: 105
n 105(i2 == il.selected)[]:
	i: 36(f)
	o: 121(t), 157(f)

nname: 69
n 69(None)[GenericListing._scroll(self, i2 - i1, self.duration, ml.selected)
]:
	i: 36(t)
	o: 158()

nname: 36
n 36(i1 == il.selected)[il = self.item_list
ml = self.menu_list
]:
	i: 21(), 35()
	o: 69(t), 105(f)

nname: 35
n 35(None)[]:
	i: 0(t)
	o: 36()

nname: 21
n 21(None)[return self.do_reset()
]:
	i: 0(f)
	o: 36()

nname: 0
n 0(GenericListing._swap_items(self, i1, i2))[]:
	i: 
	o: 21(f), 35(t)

nname: 158
n 158(None)[il.selected = ml.selected_pos
il.start = ml.selected_pos - self._selected
il.end = il.start + len(il)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[if not GenericListing._swap_items(self, i1, i2):
	return self.do_reset()
il = self.item_list
ml = self.menu_list
if i1 == il.selected:
	GenericListing._scroll(self, i2 - i1, self.duration, ml.selected)
else:
	if i2 == il.selected:
		GenericListing._scroll(self, i1 - i2, self.duration, ml.selected)
]:
	i: 
	o: 158()

nname: 0
n 0(None)[if not GenericListing._swap_items(self, i1, i2):
	return self.do_reset()
il = self.item_list
ml = self.menu_list
if i1 == il.selected:
	GenericListing._scroll(self, i2 - i1, self.duration, ml.selected)
else:
	if i2 == il.selected:
		GenericListing._scroll(self, i1 - i2, self.duration, ml.selected)
il.selected = ml.selected_pos
il.start = ml.selected_pos - self._selected
il.end = il.start + len(il)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76edd4c>}
nname: 6
n 6(None)[__doc__ = 'List where selected element it at a fixed position. '
def create_content(self):
	if self._initialized:
		pass
	self._initialized = True
	self._last_timestamp = 0
	sel_task = Task(self._fix_selected)
	sel_task.delay = self.duration * 2
	sel_task._considered_idle = True
	self._schedule_selected = sel_task.start
	start = self.menu_list.selected_pos - self._selected
	GenericListing._create_content(self, start, self.style_name[:-6])

def do_reset(self, position=None, focus=None):
	ml = self.menu_list
	il = self.item_list
	pl = self.positions_list
	start = ml.selected_pos - self._selected
	end = start + len(pl)
	len_ml = len(ml)
	selected = ml.selected
	menu_list = [None] * max(0, -start) + ml[max(0, start):end] + [None] * max(0, end - len_ml)
	if self._cyclic and len_ml > 2:
		if start < 0:
			menu_list[0:-start] = ml[len_ml + start:]
		if end > len_ml:
			diff = end - len_ml
			menu_list[-diff:] = ml[0:diff]
	if position is not None and position >= 0:
		menu_item = ml[position]
		ui_item = il[position - il.start]
		if menu_item is None:
			ui_item.destroy()
		else:
			ui_item.reset(menu_item, menu_item is selected, position=position + 1)
	else:
		for i, pos in enumerate(map(None, pl, il, menu_list)):
			ui_item.widget.animate_stop()
			pos.put(ui_item)
			if menu_item is None:
				ui_item.destroy()
				continue
			ui_item.reset(menu_item, menu_item is selected, position=start + i + 1)
		il.selected = ml.selected_pos
		il.start = start
		il.end = end
		self._hidden_item.destroy()
	self._refresh_more_items()
	if self._bar is not None:
		if len_ml and il.selected >= 0:
			self._bar.show()
		else:
			self._bar.hide()
	if self._edited:
		self._edited = False
		self.do_edit(True)
	return None

def do_update(self, position, focus=None):
	il = self.item_list
	ml = self.menu_list
	if focus is None:
		if ml.selected is None or il.selected == position:
			return True
		focus = position
	previous_focus = il.start + self._selected
	move = focus - previous_focus
	ts = sched.ts
	duration = max(0.001, min(self.duration, ts - self._last_timestamp - 0.12))
	self._last_timestamp = ts
	if il[self._selected].selected:
		il[self._selected].selected = False
	self._schedule_selected()
	scroll_move = move
	if self._cyclic:
		len_ml = len(ml)
		if len_ml > 2 and abs(move) + 1 == len_ml:
			if move > 0:
				pass
			scroll_move = 1
	GenericListing._scroll(self, scroll_move, duration, None)
	il.start += move
	il.end += move
	il.selected = position
	self._refresh_more_items()
	if self._bar is not None:
		if len(ml) and il.selected >= 0:
			self._bar.show()
		else:
			self._bar.hide()
	return None

def _fix_selected(self):
	if self.item_list.selected != -1:
		self.item_list[self._selected].selected = True

def do_remove(self, position):
	il = self.item_list
	ml = self.menu_list
	sel_index = il.selected
	if sel_index < position:
		pass
	scroll_up = ml.selected_pos == sel_index
	GenericListing._remove_item(self, position, scroll_up)
	il.selected = ml.selected_pos
	il.start = ml.selected_pos - self._selected
	il.end = il.start + len(il)
	GenericListing._refresh_more_items(self)
	il[self._selected].selected = True

def do_swap(self, i1, i2):
	if not GenericListing._swap_items(self, i1, i2):
		return self.do_reset()
	il = self.item_list
	ml = self.menu_list
	if i1 == il.selected:
		GenericListing._scroll(self, i2 - i1, self.duration, ml.selected)
	else:
		if i2 == il.selected:
			GenericListing._scroll(self, i1 - i2, self.duration, ml.selected)
	il.selected = ml.selected_pos
	il.start = ml.selected_pos - self._selected
	il.end = il.start + len(il)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76dfe4c>}
nname: 0
n 0(None)[from __future__ import absolute_import, with_statement
__all__ = ['FixedListing']
from .core import GenericListing
from peewee.notifier import sched, Task
from peewee.debug import GET_LOGGER
from wyvas import render_lock
log = GET_LOGGER(__name__)
class FixedListing(GenericListing):
	__doc__ = 'List where selected element it at a fixed position. '
	def create_content(self):
		if self._initialized:
			pass
		self._initialized = True
		self._last_timestamp = 0
		sel_task = Task(self._fix_selected)
		sel_task.delay = self.duration * 2
		sel_task._considered_idle = True
		self._schedule_selected = sel_task.start
		start = self.menu_list.selected_pos - self._selected
		GenericListing._create_content(self, start, self.style_name[:-6])

	def do_reset(self, position=None, focus=None):
		ml = self.menu_list
		il = self.item_list
		pl = self.positions_list
		start = ml.selected_pos - self._selected
		end = start + len(pl)
		len_ml = len(ml)
		selected = ml.selected
		menu_list = [None] * max(0, -start) + ml[max(0, start):end] + [None] * max(0, end - len_ml)
		if self._cyclic and len_ml > 2:
			if start < 0:
				menu_list[0:-start] = ml[len_ml + start:]
			if end > len_ml:
				diff = end - len_ml
				menu_list[-diff:] = ml[0:diff]
		if position is not None and position >= 0:
			menu_item = ml[position]
			ui_item = il[position - il.start]
			if menu_item is None:
				ui_item.destroy()
			else:
				ui_item.reset(menu_item, menu_item is selected, position=position + 1)
		else:
			for i, pos in enumerate(map(None, pl, il, menu_list)):
				ui_item.widget.animate_stop()
				pos.put(ui_item)
				if menu_item is None:
					ui_item.destroy()
					continue
				ui_item.reset(menu_item, menu_item is selected, position=start + i + 1)
			il.selected = ml.selected_pos
			il.start = start
			il.end = end
			self._hidden_item.destroy()
		self._refresh_more_items()
		if self._bar is not None:
			if len_ml and il.selected >= 0:
				self._bar.show()
			else:
				self._bar.hide()
		if self._edited:
			self._edited = False
			self.do_edit(True)
		return None

	def do_update(self, position, focus=None):
		il = self.item_list
		ml = self.menu_list
		if focus is None:
			if ml.selected is None or il.selected == position:
				return True
			focus = position
		previous_focus = il.start + self._selected
		move = focus - previous_focus
		ts = sched.ts
		duration = max(0.001, min(self.duration, ts - self._last_timestamp - 0.12))
		self._last_timestamp = ts
		if il[self._selected].selected:
			il[self._selected].selected = False
		self._schedule_selected()
		scroll_move = move
		if self._cyclic:
			len_ml = len(ml)
			if len_ml > 2 and abs(move) + 1 == len_ml:
				if move > 0:
					pass
				scroll_move = 1
		GenericListing._scroll(self, scroll_move, duration, None)
		il.start += move
		il.end += move
		il.selected = position
		self._refresh_more_items()
		if self._bar is not None:
			if len(ml) and il.selected >= 0:
				self._bar.show()
			else:
				self._bar.hide()
		return None

	def _fix_selected(self):
		if self.item_list.selected != -1:
			self.item_list[self._selected].selected = True

	def do_remove(self, position):
		il = self.item_list
		ml = self.menu_list
		sel_index = il.selected
		if sel_index < position:
			pass
		scroll_up = ml.selected_pos == sel_index
		GenericListing._remove_item(self, position, scroll_up)
		il.selected = ml.selected_pos
		il.start = ml.selected_pos - self._selected
		il.end = il.start + len(il)
		GenericListing._refresh_more_items(self)
		il[self._selected].selected = True

	def do_swap(self, i1, i2):
		if not GenericListing._swap_items(self, i1, i2):
			return self.do_reset()
		il = self.item_list
		ml = self.menu_list
		if i1 == il.selected:
			GenericListing._scroll(self, i2 - i1, self.duration, ml.selected)
		else:
			if i2 == il.selected:
				GenericListing._scroll(self, i1 - i2, self.duration, ml.selected)
		il.selected = ml.selected_pos
		il.start = ml.selected_pos - self._selected
		il.end = il.start + len(il)



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76df10c>}
from __future__ import absolute_import, with_statement
__all__ = ['FixedListing']
from .core import GenericListing
from peewee.notifier import sched, Task
from peewee.debug import GET_LOGGER
from wyvas import render_lock
log = GET_LOGGER(__name__)
class FixedListing(GenericListing):
	__doc__ = 'List where selected element it at a fixed position. '
	def create_content(self):
		if self._initialized:
			pass
		self._initialized = True
		self._last_timestamp = 0
		sel_task = Task(self._fix_selected)
		sel_task.delay = self.duration * 2
		sel_task._considered_idle = True
		self._schedule_selected = sel_task.start
		start = self.menu_list.selected_pos - self._selected
		GenericListing._create_content(self, start, self.style_name[:-6])

	def do_reset(self, position=None, focus=None):
		ml = self.menu_list
		il = self.item_list
		pl = self.positions_list
		start = ml.selected_pos - self._selected
		end = start + len(pl)
		len_ml = len(ml)
		selected = ml.selected
		menu_list = [None] * max(0, -start) + ml[max(0, start):end] + [None] * max(0, end - len_ml)
		if self._cyclic and len_ml > 2:
			if start < 0:
				menu_list[0:-start] = ml[len_ml + start:]
			if end > len_ml:
				diff = end - len_ml
				menu_list[-diff:] = ml[0:diff]
		if position is not None and position >= 0:
			menu_item = ml[position]
			ui_item = il[position - il.start]
			if menu_item is None:
				ui_item.destroy()
			else:
				ui_item.reset(menu_item, menu_item is selected, position=position + 1)
		else:
			for i, pos in enumerate(map(None, pl, il, menu_list)):
				ui_item.widget.animate_stop()
				pos.put(ui_item)
				if menu_item is None:
					ui_item.destroy()
					continue
				ui_item.reset(menu_item, menu_item is selected, position=start + i + 1)
			il.selected = ml.selected_pos
			il.start = start
			il.end = end
			self._hidden_item.destroy()
		self._refresh_more_items()
		if self._bar is not None:
			if len_ml and il.selected >= 0:
				self._bar.show()
			else:
				self._bar.hide()
		if self._edited:
			self._edited = False
			self.do_edit(True)
		return None

	def do_update(self, position, focus=None):
		il = self.item_list
		ml = self.menu_list
		if focus is None:
			if ml.selected is None or il.selected == position:
				return True
			focus = position
		previous_focus = il.start + self._selected
		move = focus - previous_focus
		ts = sched.ts
		duration = max(0.001, min(self.duration, ts - self._last_timestamp - 0.12))
		self._last_timestamp = ts
		if il[self._selected].selected:
			il[self._selected].selected = False
		self._schedule_selected()
		scroll_move = move
		if self._cyclic:
			len_ml = len(ml)
			if len_ml > 2 and abs(move) + 1 == len_ml:
				if move > 0:
					pass
				scroll_move = 1
		GenericListing._scroll(self, scroll_move, duration, None)
		il.start += move
		il.end += move
		il.selected = position
		self._refresh_more_items()
		if self._bar is not None:
			if len(ml) and il.selected >= 0:
				self._bar.show()
			else:
				self._bar.hide()
		return None

	def _fix_selected(self):
		if self.item_list.selected != -1:
			self.item_list[self._selected].selected = True

	def do_remove(self, position):
		il = self.item_list
		ml = self.menu_list
		sel_index = il.selected
		if sel_index < position:
			pass
		scroll_up = ml.selected_pos == sel_index
		GenericListing._remove_item(self, position, scroll_up)
		il.selected = ml.selected_pos
		il.start = ml.selected_pos - self._selected
		il.end = il.start + len(il)
		GenericListing._refresh_more_items(self)
		il[self._selected].selected = True

	def do_swap(self, i1, i2):
		if not GenericListing._swap_items(self, i1, i2):
			return self.do_reset()
		il = self.item_list
		ml = self.menu_list
		if i1 == il.selected:
			GenericListing._scroll(self, i2 - i1, self.duration, ml.selected)
		else:
			if i2 == il.selected:
				GenericListing._scroll(self, i1 - i2, self.duration, ml.selected)
		il.selected = ml.selected_pos
		il.start = ml.selected_pos - self._selected
		il.end = il.start + len(il)



